<?php require 'Home/View/template/header.php'; ?>
    <!-- Carousel================================================== -->
    <div id="myCarousel" class="carousel slide" data-ride="carousel">
        <ol class="carousel-indicators">
            <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
            <li data-target="#myCarousel" data-slide-to="1"></li>
            <li data-target="#myCarousel" data-slide-to="2"></li>
        </ol>
        <div class="carousel-inner" role="listbox">
            <div class="item active">
                <img src="asset/images/cs.jpg" alt="First slide" class="img-rounded">
                <div class="container">
                    <div class="carousel-caption">
                        <h1>寻找你心中的家</h1>
                        <p>在茫茫的城市中</p>
                        <?php  if(isset($_SESSION['user'])) { ?>
                        <p><a class="btn btn-lg btn-primary" href="index.php?c=House&m=House" role="button">进入寻找房源之旅</a></p>
                        <?php } else { ?>
                        <p><a class="btn btn-lg btn-primary" href="index.php?c=user&m=UserLoginview" role="button">登录去寻找房源吧</a></p>
                        <?php } ?>
                    </div>
                </div>
            </div>
        </div>
    </div>
        <!-- /.carousel -->
        <br>
        <div class="alert alert-success" role="alert"><h4 align="center">热门租房推荐</h4></div>
        <br>
        <!-- Marketing messaging and featurettes================================================== -->
        <div class="container marketing">
            <!-- row -->
            <div class="row">
                <?php
                foreach($h_data as $row) {
                    echo '<div class="col-lg-4 text-center">';
                    echo ' <img class="img-circle" src="asset/images/'.$row['pic'].'"d alt="Generic placeholder image" style="width: 140px; height: 140px;">';
                    echo '<br>';
                    echo '<h4>'.'所在区域:  '.$row['region'].'</h4>';
                    echo '<h4>'.'房屋类型:  '.$row['housetype'].'</h4>';
                    echo '<h4>'.'房屋租金:  '.$row['rent'].'元/月'.'</h4>';
                    if(isset($_SESSION['user'])){
                       echo '<p><a class="btn btn-success" href="index.php?c=House&m=Housedetail&id='.$row['id'].' "role = "button">房屋详情</a ></p>'; 
                   } else {
                        echo '<p><a class="btn btn-success" href="index.php?c=user&m=UserLoginview" role = "button">房屋详情</a></p>';
                   }
                    echo '</div>';
                }
                ?>
            </div>
            <!-- /.row -->
            <!-- START THE FEATURETTES -->
            <hr class="featurette-divider">
            <div class="row featurette">
                <br>
                <div class="alert alert-success" role="alert"><h4 align="center">热门售房推荐</h4></div>
                <br>
                <?php
                foreach($p_data as $row){
                    echo '<div class="col-md-12">';
                    echo '<div class="col-md-8">';
                    echo '<h4>'.'所在区域:  '.$row['region'].'</h4>';
                    echo '<h4>'.'房屋售价:  '.$row['price'].'万元'.'</h4 >';
                    echo '<h4>房源特色:</h4>';
                    echo '<p>'.$row['demo'].'</p>';
                    echo '<p><a class="btn btn-success" href="index.php?c=House&m=Housedetail&id='.$row['id'].' " role = "button">房屋详情</a ></p >';
                    echo '</div>';
                    echo '<div align="right" class="col-md-4">';
                    // echo '<br/>';
                    echo '<img class="featurette-image img-rounded" src="asset/images/'.$row['pic'].'" alt="Not Found" style="width: 200px; height:150px; vertical-algin:text-bottom">';
                    echo '</div>';
                    echo '</div>';
                    // echo '<br/>';
                }
                ?>
            </div>
        </div>
    <!-- /.END THE FEATURETTES -->
<?php require 'Home/View/template/footer.php'; ?>